<template>
  <div>
    <div @click="login">点击登录</div>
  </div>
</template>

<script>
import {authLogin} from '~/api/login'
import { mapMutations } from 'vuex'
export default {
  data () {
    return {}
  },
  created () {
    
  },
  methods: {
    ...mapMutations({
      setUser: 'setUser',
      setToken: 'setToken'
    }),
    async login () {
      let params = {
        method:1,
        sourse: 'admin',
        phone: '18866668888',
        password: '123456'
      }
      let {data} = await authLogin(params)
      this.setUser(data.user)
      this.setToken(data.token)
      this.$cookies.set('token',data.token)
    },

  }
}
</script>

<style lang='less' scoped></style>